/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans.managed;

import beans.ejb.FantasyuserFacade;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author nujwoo
 */
@ManagedBean
@RequestScoped
public class FindFantasyUserBean implements Serializable {
    
    @EJB
    private FantasyuserFacade userFacade;
    
    public FindFantasyUserBean() {
        System.err.print("1");
    }

    public String getEmailList()
    {
        List l= userFacade.getUserList();
      
        String resultList ="";
        
        Iterator it = l.iterator();
        
        if(it.hasNext())
            resultList += it.next();
             
        while(it.hasNext())
        {
            resultList += ",";
            resultList += it.next();
        }
 
        
        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
        request.setAttribute("resultList", resultList);
        
        return resultList;
        
    }
    
    
}
